/*
 * @Name: 
 * @Author: LiuCaiLin
 * @Date: 2020-04-28 18:44:46
 * @LastEditors: LiuCaiLin
 * @LastEditTime: 2020-04-29 11:47:21
 */
//index.js
//获取应用实例
const app = getApp()
import {
	request
} from '../../utils/request.js'
Page({
	data: {
		indicatorDots: true,
		vertical: false,
		autoplay: true,
		interval: 10000,
		duration: 500,
		carouselList: ['/images/localhost/demo.jpg', '/images/localhost/demo.jpg', '/images/localhost/demo.jpg'],
		indexData: {},
		swiperIndex: 0,
		circular: true,
    show:false
	},
  onLoad: function (options) {
    request({
      url: 'getTitle',
    }).then(res => {
      wx.setNavigationBarTitle({
        title: res.data
      })
    })
    this.getData()
  },
	onShow() {
		
	},
	bindGetUserInfo: function (e) {
		console.log(e.detail.userInfo)
	},
	getData() {
		request({
			url: 'index',
		}).then(res => {
			console.log(res)
			this.setData({
				indexData: res.data.data
			})
		})
	},

	toHref(e) {
		let href = e.currentTarget.dataset.href;
		wx.navigateTo({
			url: `/pages/outpage/outpage?href=${href}`
		})
	},

	toNews(e) {
		let id = e.currentTarget.dataset.id;
		wx.navigateTo({
			url: `/pages/newsTemp/newsTemp?id=${id}`
		})
	},
  // 公告详情弹框
  showNotice() {
    this.setData({
      show: true
    })
  },
  onClose() {
    this.setData({
      show: false
    })
  },
	swiperChange(e) {
		this.setData({
			swiperIndex: e.detail.current,
		})
	},
	onPullDownRefresh: function () {
		// wx.showLoading({
		// 	title: '刷新中...'
		// });
	}
})
